package com.hspjava.stringbuffer_;

public class StringAndStringBuffer {
    public static void main(String[] args) {
        String str = "hello tom";

        //方式1使用构造器
        //返回的是StringBuffer对象，对str本身没有影响
        StringBuffer stringBuffer = new StringBuffer(str);

        //用append
        StringBuffer stringBuffer01 = new StringBuffer();
        stringBuffer01.append(str);


        //StringBuffer -> String
        //1.toString
        StringBuffer stringBuffer3 = new StringBuffer("lfm Education");

        String s = stringBuffer3.toString();


        //2.构造器
        String s1 = new String(stringBuffer3);


    }
}
